package site.edody.dframe.websocket;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * DFrame WebSocket 配置属性类
 * @author Dody
 */
//@Component
//@ConfigurationProperties(prefix = "dframe.websocket")
public class DFrameWebSocketProperties {

    private Map<String, ServerConfig> servers;

    public static class ServerConfig {
        private int port;
        private String listener;
//        private String path = "/";

        // getters and setters
        public int getPort() { return port; }
        public void setPort(int port) { this.port = port; }

        public String getListener() { return listener; }
        public void setListener(String listener) { this.listener = listener; }

//        public String getPath() { return path; }
//        public void setPath(String path) { this.path = path; }

        @Override
        public String toString() {
//            return "ServerConfig{port=" + port + ", listener='" + listener + "', path='" + path + "'}";
            return "ServerConfig{port=" + port + ", listener='" + listener + "'}";

        }
    }

    public Map<String, ServerConfig> getServers() {
        return servers;
    }

    public void setServers(Map<String, ServerConfig> servers) {
        this.servers = servers;
    }

    @Override
    public String toString() {
        return "DFrameWebSocketProperties{servers=" + servers + "}";
    }
}